<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登陆</title>
<base href="${pageContext.request.contextPath}/" />

<link rel="stylesheet" type="text/css" href="easyui/themes/metro/easyui.css">
<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="easyui/demo/demo.css">
</head>
<body>
	<div id="ep" class="easyui-panel" title="登陆系统" style="width: 400px; padding: 30px 70px 20px 70px;" data-options="style:{position:'relative', margin:'0 auto'}">
<!-- 	<div class="easyui-panel" title="登陆系统" style="width: 400px; padding: 30px 70px 20px 70px;" data-options="style:{position:'relative', top:250, left:'37%' }"> -->
		<form id="login" class="easyui-form" method="post" data-options="novalidate:true">
			<div style="margin-bottom: 10px">
				<input name="userName" class="easyui-textbox" style="width: 100%; height: 40px; padding: 12px" data-options="prompt:'Username',iconCls:'icon-man',iconWidth:38,required:true">
			</div>
			<div style="margin-bottom: 20px">
				<input name="password" class="easyui-textbox" type="password" style="width: 100%; height: 40px; padding: 12px" data-options="prompt:'Password',iconCls:'icon-lock',iconWidth:38,required:true">
			</div>
			<div style="margin-bottom: 20px">
				<input type="checkbox"> <span>记住我</span>
			</div>
			<div>
				<a href="javascript:void(0)" class="easyui-linkbutton"  onclick="login()" style="padding: 5px 0px; width: 100%;"> <span style="font-size: 14px;">登陆</span></a>
			</div>
		</form>
	</div>
	<script type="text/javascript" src="easyui/jquery.min.js"></script>
	<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
	<script>
		function login(){
	        $('#login').form('submit',{
	            url:'login',
	            onSubmit:function(){
	                return $(this).form('enableValidation').form('validate');
	            },
	            success:function(data){
	                json = JSON.parse(data);
	                if (json.status === 1) {
	                    window.location.href='app/main';
	                } else {
	                    $.messager.alert('Warning',json.message);
	                }
	            }
	        });
	    }	
	
	    $(function($){
	    	$("#ep").panel("move",{top:($(window).height()-344) * 0.5});//居中定位
			$("#login").keypress(function(e) {
	            if (e.which == 13) {
	                login();
	            }
	        });
			
		})
	</script>
</body>
</html>